package leetcode.leetcode_hot100;

/**
 * @ClassName T0062
 * @Description 不同路径
 * @Author Fanxc
 * @DATE 2021/6/19 19:48
 * @Version 1.0
 */
public class T0062 {
    //mn=max(m-1n+1,mn-1+1)
    class Solution {
        public int uniquePaths(int m, int n) {
            int[][] a=new int[m][n];
            for (int i = 0; i < m; i++) {
                a[i][0]=1;
            }
            for (int i = 0; i < n; i++) {
                a[0][i]=1;
            }
            for (int i = 1; i < m; i++) {
                for (int j = 1; j < n; j++) {
                    a[i][j]=a[i-1][j]+a[i][j-1];
                }
            }
            return a[m-1][n-1];
        }
    }
}
